home *** CD-ROM | disk | FTP | other *** search
/ Palm Utilities / Palm_Utilities_CD-ROM_2001_2001.iso / files / system files / TrapWeaver 1.05 / tweaver.exe / tw_suite.h < prev    next >
Encoding:
C/C++ Source or Header  |  1999-10-04  |  3.2 KB  |  84 lines

  1. /* 
  2.  
  3.     TrapWeaver Suite header file
  4.         
  5.     Version 1 - Written by Josh Freeman
  6.  
  7.     (c)1998 Twilight Edge Software
  8.  
  9.     Email:  software@twilightedge.com
  10.  
  11.     This file may be freely distributed provided it is unchanged.
  12.  
  13.     **********************************************************************
  14.  
  15.     A set of functions to make it easier to set up and manage system patches.
  16.     
  17.     This suite is only for convenience and is not required in order to make use of 
  18.     TrapWeaver's patch management functionality, with one exception: If your patch
  19.     needs to call SysSet/GetTrapAddress() from within itself, please see the comments 
  20.     accompanying CreatorSet/GetTrapAddress() below.
  21.  
  22. */
  23.  
  24. #ifndef _trapweaversuite_h_
  25. #define _trapweaversuite_h_
  26.  
  27. #ifndef __PILOT_H__ 
  28. #include <Pilot.h>
  29. #endif
  30.  
  31. #define    kTrapWeaverCreatorID        'TpWv'
  32. #define kTrapWeaverSuiteFtr            100
  33.  
  34. /* 
  35.  
  36.     TrapWeaverSuite Version 1
  37.     
  38.     SetupPatch() - Copies the procedure at 'procP' to TrapWeaver's runtime database,
  39.         locks it down, calls SysSetTrapAddress() on the DB entry. Needs to know the size
  40.         of the patch, which can be found by disassembling the source file.
  41.         To remove your patch, restore the trap address to the value it held before 
  42.         setting the patch up. (Call SysGetTrapAddress() before you patch, save the result,
  43.         and pass it to SysSetTrapAddress() to uninstall the patch) The entry in the runtime
  44.         database will automatically be deleted when a patch is removed.
  45.         
  46.     NewReadOnlyChunk(), OverwriteReadOnlyChunk(), and DeleteReadOnlyChunk() are mirrors of 
  47.         Data Manager routines, except they read and write only to the TrapWeaver runtime 
  48.         database. These are useful for storing non-patch utility functions that may be 
  49.         called by your patches or other apps.
  50.         
  51.     CreatorSetTrapAddress(), CreatorGetTrapAddress() - These functions are necessary ONLY if
  52.         you need to call SysSet/GetTrapAddress() from inside a patch, such as for setting
  53.         up another patch from within your first patch. 
  54.         -----------------------------------------------------------------------------------
  55.         IMPORTANT: Any patch which needs to call SysSet/GetTrapAddress() should use these 
  56.         functions instead. 
  57.         -----------------------------------------------------------------------------------
  58.         This is because TrapWeaver keeps track of whichever app is currently running when 
  59.         SysSet/GetTrapAddress() are called - if another app is running and your patch 
  60.         attempts to set up a patch, TrapWeaver will mistakenly assume that the other app 
  61.         is the one doing the patching. CreatorSet/GetTrapAddress() will take your app's 
  62.         creator ID and TrapWeaver will ignore the currently-running app's ID, so that it 
  63.         correctly identifies the patch's owner.
  64.  
  65. */
  66.  
  67. typedef struct
  68. {
  69.     ULong        TrapWeaverVersion;    
  70.     ULong        suiteVersion;        // value: 1
  71.     Err             (*SetupPatch) (UInt trapNum, VoidPtr procP, ULong size);
  72.  
  73.     VoidPtr        (*NewReadOnlyChunk) (VoidPtr procP, ULong size);
  74.     Err            (*OverwriteReadOnlyChunk) (VoidPtr chunk, ULong offset, VoidPtr newChunk, 
  75.                                             ULong size);
  76.     Err            (*DeleteReadOnlyChunk) (VoidPtr chunk);
  77.  
  78.     Err         (*CreatorSetTrapAddress) (ULong creatorID, UInt trapNum, VoidPtr procP);
  79.     VoidPtr        (*CreatorGetTrapAddress) (ULong creatorID, UInt trapNum);
  80.  
  81. } TrapWeaverSuite1;
  82.  
  83.  
  84. #endif // trapweaversuite.h